//
//  LKBillListCell.m
//  Mideleague_Shop
//
//  Created by Zhiwang on 2020/6/30.
//  Copyright © 2020 Zhiwang. All rights reserved.
//

#import "LKBillListCell.h"

@interface LKBillListCell()
@property (weak, nonatomic) IBOutlet UILabel *paystyleLabel;

@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImage;


@end


@implementation LKBillListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setModel:(LKBillListModel *)model{
    _model = model;
    self.paystyleLabel.text = _model.mode_name;
    NSString *timeStr = [NSString stringWithFormat:@"%@",[NSString timestampSwitchTime:[_model.paytime integerValue] andFormatter:@"YYYY-MM-dd HH:mm:ss"]];
    self.dateLabel.text = [[timeStr componentsSeparatedByString:@" "] lastObject];
    NSString *payStyle = _model.paystyle_id;
    if ([payStyle isEqualToString:@"1"]) {
        self.iconImage.image = [UIImage imageNamed:@"ic_payment_we_chat"];
    }else if ([payStyle isEqualToString:@"2"]){
        self.iconImage.image = [UIImage imageNamed:@"ic_payment_ali_pay"];
    }else if ([payStyle isEqualToString:@"3"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }else if ([payStyle isEqualToString:@"4"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }else if ([payStyle isEqualToString:@"5"]){
        self.iconImage.image = [UIImage imageNamed:@"ic_payment_cash"];
    }else if ([payStyle isEqualToString:@"6"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }else if ([payStyle isEqualToString:@"7"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }else if ([payStyle isEqualToString:@"8"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }else if ([payStyle isEqualToString:@"10"]){
        self.iconImage.image = [UIImage imageNamed:@""];
    }
    else if ([payStyle isEqualToString:@"9"]){
        self.iconImage.image = [UIImage imageNamed:@"ic_payment_cloud_pay"];
    }
    if ([_model.status isEqualToString:@"5"]) {
        self.moneyLabel.text = [NSString stringWithFormat:@"-￥%@",_model.price];
        self.statusLabel.text = @"退款成功";
        self.statusLabel.textColor = [UIColor redColor];
        if ([payStyle isEqualToString:@"5"]) {
            self.iconImage.image = [UIImage imageNamed:@"ic_refund_cash"];
        }else{
            self.iconImage.image = [UIImage imageNamed:@"ic_refund_back"];
        }
    }else{
        self.moneyLabel.text = [NSString stringWithFormat:@"￥%@",_model.price];
        self.statusLabel.text = @"支付成功";
        self.statusLabel.textColor = COLOR_HEX(0x666666);
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
